package com.gdit.revenue.service.Impl;
import com.gdit.revenue.base.result.Results;
import com.gdit.revenue.dao.IncomeDao;
import com.gdit.revenue.dao.UserDao;
import com.gdit.revenue.model.Income;
import com.gdit.revenue.model.User;
import com.gdit.revenue.service.IncomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class IncomeServiceImpl implements IncomeService {

    @Autowired
    IncomeDao incomeDao;

    @Override
    public Results getAllIncome(int offset, int limit) {
        //获取到记录对象的总行数
        int count = incomeDao.count();
        return Results.success(count,incomeDao.getAllIncome(offset,limit));
    }


    @Override
    public Results delete(int inId) {
        return Results.success(incomeDao.delete(inId));
    }

    @Override
    public void addIncome(Income income) {
        incomeDao.insert(income);
    }

    @Override
    public Results updateIncome(Income income) {
        return Results.success(incomeDao.update(income));
    }
}
